package com.asset.dispoal.business.bsCase.service;

import com.asset.dispoal.business.bsCase.api.BsCaseService;
import com.asset.dispoal.business.bsCase.dto.BsCaseRequest;
import com.asset.dispoal.business.bsCase.dto.BsCaseResponse;
import com.asset.dispoal.business.bsCase.service.commom.CaseAbolishCaseCommand;
import com.asset.dispoal.business.bsCase.service.commom.CaseCloseCaseCommand;
import com.asset.dispoal.business.bsCase.service.commom.CaseStaticsticsCommand;
import com.asset.dispoal.business.bsCase.service.commom.QueryBorrowerCaseByPageCommand;
import com.asset.dispoal.business.bsCase.service.commom.QueryCaseByIdCommand;
import com.asset.dispoal.business.bsCase.service.commom.UpdateCaseAreaIdCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * @author qr
 * @date 2022/4/12$
 */
@Service
public class BsCaseServiceImpl implements BsCaseService {

    @Autowired
    QueryBorrowerCaseByPageCommand queryBorrowerCaseByPageCommand;

    @Autowired
    private QueryCaseByIdCommand queryCaseByIdCommand;

    @Autowired
    private CaseCloseCaseCommand caseCloseCaseCommand;

    @Autowired
    private CaseAbolishCaseCommand caseAbolishCaseCommand;

    @Autowired
    private UpdateCaseAreaIdCommand updateCaseAreaIdCommand;

    @Autowired
    private CaseStaticsticsCommand caseStaticsticsCommand;


    @Override
    public Result<PageVO<BsCaseResponse>> queryBorrowerCaseByPage(BsCaseRequest bsCaseRequest) {
        return queryBorrowerCaseByPageCommand.execute(bsCaseRequest);
    }

    @Override
    public Result<BsCaseResponse> getCaseById(String id) {
        return queryCaseByIdCommand.execute(id);
    }

    @Override
    public Result caseClose(String agreementId) {
        return caseCloseCaseCommand.execute(agreementId);
    }

    @Override
    public Result abolishCase(String id, String wasteReasonId) {
        return caseAbolishCaseCommand.execute(id, wasteReasonId);
    }

    @Override
    public Result censusRefresh() {
        return updateCaseAreaIdCommand.execute();
    }

    @Override
    public Result statistics(String code) {
        return caseStaticsticsCommand.execute(code);
    }
}
